Optimal. Leaf size=159 \[ \frac {5 \left (a^2+8 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{128 d}-\frac {2 a b \cot ^7(c+d x)}{7 d}+\frac {\left (5 a^2-88 b^2\right ) \cot (c+d x) \csc (c+d x)}{128 d}-\frac {\left (59 a^2-104 b^2\right ) \cot (c+d x) \csc ^3(c+d x)}{192 d}+\frac {\left (17 a^2-8 b^2\right ) \cot (c+d x) \csc ^5(c+d x)}{48 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 159, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 9, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.310, Rules used = {2990, 2687, 30,
4451, 466, 1828, 1171, 393, 212} \begin {gather*} \frac {5 \left (a^2+8 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{128 d}+\frac {\left (17 a^2-8 b^2\right ) \cot (c+d x) \csc ^5(c+d x)}{48 d}-\frac {\left (59 a^2-104 b^2\right ) \cot (c+d x) \csc ^3(c+d x)}{192 d}+\frac {\left (5 a^2-88 b^2\right ) \cot (c+d x) \csc (c+d x)}{128 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d}-\frac {2 a b \cot ^7(c+d x)}{7 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 30
Rule 212
Rule 393
Rule 466
Rule 1171
Rule 1828
Rule 2687
Rule 2990
Rule 4451
Rubi steps
\begin {align*} \int \cot ^6(c+d x) \csc ^3(c+d x) (a+b \sin (c+d x))^2 \, dx &=(2 a b) \int \cot ^6(c+d x) \csc ^2(c+d x) \, dx+\int \cot ^6(c+d x) \csc ^3(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \, dx\\ &=-\frac {\text {Subst}\left (\int \frac {x^6 \left (a^2+b^2-b^2 x^2\right )}{\left (1-x^2\right )^5} \, dx,x,\cos (c+d x)\right )}{d}+\frac {(2 a b) \text {Subst}\left (\int x^6 \, dx,x,-\cot (c+d x)\right )}{d}\\ &=-\frac {2 a b \cot ^7(c+d x)}{7 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d}+\frac {\text {Subst}\left (\int \frac {a^2+8 a^2 x^2+8 a^2 x^4-8 b^2 x^6}{\left (1-x^2\right )^4} \, dx,x,\cos (c+d x)\right )}{8 d}\\ &=-\frac {2 a b \cot ^7(c+d x)}{7 d}+\frac {\left (17 a^2-8 b^2\right ) \cot (c+d x) \csc ^5(c+d x)}{48 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d}-\frac {\text {Subst}\left (\int \frac {11 a^2-8 b^2+48 \left (a^2-b^2\right ) x^2-48 b^2 x^4}{\left (1-x^2\right )^3} \, dx,x,\cos (c+d x)\right )}{48 d}\\ &=-\frac {2 a b \cot ^7(c+d x)}{7 d}-\frac {\left (59 a^2-104 b^2\right ) \cot (c+d x) \csc ^3(c+d x)}{192 d}+\frac {\left (17 a^2-8 b^2\right ) \cot (c+d x) \csc ^5(c+d x)}{48 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d}+\frac {\text {Subst}\left (\int \frac {3 \left (5 a^2-24 b^2\right )-192 b^2 x^2}{\left (1-x^2\right )^2} \, dx,x,\cos (c+d x)\right )}{192 d}\\ &=-\frac {2 a b \cot ^7(c+d x)}{7 d}+\frac {\left (5 a^2-88 b^2\right ) \cot (c+d x) \csc (c+d x)}{128 d}-\frac {\left (59 a^2-104 b^2\right ) \cot (c+d x) \csc ^3(c+d x)}{192 d}+\frac {\left (17 a^2-8 b^2\right ) \cot (c+d x) \csc ^5(c+d x)}{48 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d}+\frac {\left (5 \left (a^2+8 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{128 d}\\ &=\frac {5 \left (a^2+8 b^2\right ) \tanh ^{-1}(\cos (c+d x))}{128 d}-\frac {2 a b \cot ^7(c+d x)}{7 d}+\frac {\left (5 a^2-88 b^2\right ) \cot (c+d x) \csc (c+d x)}{128 d}-\frac {\left (59 a^2-104 b^2\right ) \cot (c+d x) \csc ^3(c+d x)}{192 d}+\frac {\left (17 a^2-8 b^2\right ) \cot (c+d x) \csc ^5(c+d x)}{48 d}-\frac {a^2 \cot (c+d x) \csc ^7(c+d x)}{8 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.57, size = 282, normalized size = 1.77 \begin {gather*} -\frac {7 \left (895 a^2-904 b^2\right ) \cos (3 (c+d x)) \csc ^8(c+d x)+2779 a^2 \cos (5 (c+d x)) \csc ^8(c+d x)+3416 b^2 \cos (5 (c+d x)) \csc ^8(c+d x)+105 a^2 \cos (7 (c+d x)) \csc ^8(c+d x)-1848 b^2 \cos (7 (c+d x)) \csc ^8(c+d x)-6720 a^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-53760 b^2 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+6720 a^2 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+53760 b^2 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+7 \cot (c+d x) \csc ^7(c+d x) \left (1765 a^2+680 b^2+1536 a b \sin (c+d x)\right )+5376 a b \csc ^8(c+d x) \sin (4 (c+d x))+2304 a b \csc ^8(c+d x) \sin (6 (c+d x))+384 a b \csc ^8(c+d x) \sin (8 (c+d x))}{172032 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.38, size = 254, normalized size = 1.60
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {\cos ^{7}\left (d x +c \right )}{8 \sin \left (d x +c \right )^{8}}-\frac {\cos ^{7}\left (d x +c \right )}{48 \sin \left (d x +c \right )^{6}}+\frac {\cos ^{7}\left (d x +c \right )}{192 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{7}\left (d x +c \right )}{128 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{5}\left (d x +c \right )\right )}{128}-\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{384}-\frac {5 \cos \left (d x +c \right )}{128}-\frac {5 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{128}\right )-\frac {2 a b \left (\cos ^{7}\left (d x +c \right )\right )}{7 \sin \left (d x +c \right )^{7}}+b^{2} \left (-\frac {\cos ^{7}\left (d x +c \right )}{6 \sin \left (d x +c \right )^{6}}+\frac {\cos ^{7}\left (d x +c \right )}{24 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{7}\left (d x +c \right )}{16 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{5}\left (d x +c \right )\right )}{16}-\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{48}-\frac {5 \cos \left (d x +c \right )}{16}-\frac {5 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{16}\right )}{d}\) | \(254\) |
default | \(\frac {a^{2} \left (-\frac {\cos ^{7}\left (d x +c \right )}{8 \sin \left (d x +c \right )^{8}}-\frac {\cos ^{7}\left (d x +c \right )}{48 \sin \left (d x +c \right )^{6}}+\frac {\cos ^{7}\left (d x +c \right )}{192 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{7}\left (d x +c \right )}{128 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{5}\left (d x +c \right )\right )}{128}-\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{384}-\frac {5 \cos \left (d x +c \right )}{128}-\frac {5 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{128}\right )-\frac {2 a b \left (\cos ^{7}\left (d x +c \right )\right )}{7 \sin \left (d x +c \right )^{7}}+b^{2} \left (-\frac {\cos ^{7}\left (d x +c \right )}{6 \sin \left (d x +c \right )^{6}}+\frac {\cos ^{7}\left (d x +c \right )}{24 \sin \left (d x +c \right )^{4}}-\frac {\cos ^{7}\left (d x +c \right )}{16 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{5}\left (d x +c \right )\right )}{16}-\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{48}-\frac {5 \cos \left (d x +c \right )}{16}-\frac {5 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{16}\right )}{d}\) | \(254\) |
risch | \(-\frac {-16128 i a b \,{\mathrm e}^{6 i \left (d x +c \right )}+105 a^{2} {\mathrm e}^{15 i \left (d x +c \right )}-1848 b^{2} {\mathrm e}^{15 i \left (d x +c \right )}-768 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}+2779 a^{2} {\mathrm e}^{13 i \left (d x +c \right )}+3416 b^{2} {\mathrm e}^{13 i \left (d x +c \right )}+5376 i a b \,{\mathrm e}^{12 i \left (d x +c \right )}+6265 a^{2} {\mathrm e}^{11 i \left (d x +c \right )}-6328 b^{2} {\mathrm e}^{11 i \left (d x +c \right )}+26880 i a b \,{\mathrm e}^{8 i \left (d x +c \right )}+12355 a^{2} {\mathrm e}^{9 i \left (d x +c \right )}+4760 b^{2} {\mathrm e}^{9 i \left (d x +c \right )}-5376 i a b \,{\mathrm e}^{14 i \left (d x +c \right )}+12355 a^{2} {\mathrm e}^{7 i \left (d x +c \right )}+4760 b^{2} {\mathrm e}^{7 i \left (d x +c \right )}+768 i a b +6265 a^{2} {\mathrm e}^{5 i \left (d x +c \right )}-6328 b^{2} {\mathrm e}^{5 i \left (d x +c \right )}-26880 i a b \,{\mathrm e}^{10 i \left (d x +c \right )}+2779 \,{\mathrm e}^{3 i \left (d x +c \right )} a^{2}+3416 b^{2} {\mathrm e}^{3 i \left (d x +c \right )}+16128 i a b \,{\mathrm e}^{4 i \left (d x +c \right )}+105 a^{2} {\mathrm e}^{i \left (d x +c \right )}-1848 b^{2} {\mathrm e}^{i \left (d x +c \right )}}{1344 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{8}}-\frac {5 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{128 d}-\frac {5 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b^{2}}{16 d}+\frac {5 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{128 d}+\frac {5 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b^{2}}{16 d}\) | \(428\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 220, normalized size = 1.38 \begin {gather*} -\frac {7 \, a^{2} {\left (\frac {2 \, {\left (15 \, \cos \left (d x + c\right )^{7} + 73 \, \cos \left (d x + c\right )^{5} - 55 \, \cos \left (d x + c\right )^{3} + 15 \, \cos \left (d x + c\right )\right )}}{\cos \left (d x + c\right )^{8} - 4 \, \cos \left (d x + c\right )^{6} + 6 \, \cos \left (d x + c\right )^{4} - 4 \, \cos \left (d x + c\right )^{2} + 1} - 15 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 15 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - 56 \, b^{2} {\left (\frac {2 \, {\left (33 \, \cos \left (d x + c\right )^{5} - 40 \, \cos \left (d x + c\right )^{3} + 15 \, \cos \left (d x + c\right )\right )}}{\cos \left (d x + c\right )^{6} - 3 \, \cos \left (d x + c\right )^{4} + 3 \, \cos \left (d x + c\right )^{2} - 1} + 15 \, \log \left (\cos \left (d x + c\right ) + 1\right ) - 15 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + \frac {1536 \, a b}{\tan \left (d x + c\right )^{7}}}{5376 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 338 vs.
\(2 (147) = 294\).
time = 0.39, size = 338, normalized size = 2.13 \begin {gather*} -\frac {1536 \, a b \cos \left (d x + c\right )^{7} \sin \left (d x + c\right ) + 42 \, {\left (5 \, a^{2} - 88 \, b^{2}\right )} \cos \left (d x + c\right )^{7} + 1022 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{5} - 770 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{3} + 210 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right ) - 105 \, {\left ({\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{8} - 4 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{6} + 6 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 4 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + a^{2} + 8 \, b^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 105 \, {\left ({\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{8} - 4 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{6} + 6 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{4} - 4 \, {\left (a^{2} + 8 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + a^{2} + 8 \, b^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{5376 \, {\left (d \cos \left (d x + c\right )^{8} - 4 \, d \cos \left (d x + c\right )^{6} + 6 \, d \cos \left (d x + c\right )^{4} - 4 \, d \cos \left (d x + c\right )^{2} + d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 402 vs.
\(2 (147) = 294\).
time = 0.56, size = 402, normalized size = 2.53 \begin {gather*} \frac {21 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{8} + 96 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 112 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} + 112 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 672 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 168 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1008 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 2016 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 336 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 5040 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3360 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1680 \, {\left (a^{2} + 8 \, b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + \frac {4566 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{8} + 36528 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{8} + 3360 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 336 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 5040 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{6} - 2016 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 168 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 1008 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 672 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 112 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 112 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 96 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 21 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{8}}}{43008 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.69, size = 343, normalized size = 2.16 \begin {gather*} \frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8}{2048\,d}-\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (\frac {5\,a^2}{128}+\frac {5\,b^2}{16}\right )}{d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\,\left (2\,a^2+30\,b^2\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {2\,a^2}{3}-\frac {2\,b^2}{3}\right )+\frac {a^2}{8}+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (a^2-6\,b^2\right )-4\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+12\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5-20\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\frac {4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{7}\right )}{256\,d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {a^2}{128}+\frac {15\,b^2}{128}\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (\frac {a^2}{256}-\frac {3\,b^2}{128}\right )}{d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\,\left (\frac {a^2}{384}-\frac {b^2}{384}\right )}{d}+\frac {3\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{64\,d}-\frac {a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5}{64\,d}+\frac {a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7}{448\,d}-\frac {5\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{64\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________